package com.ordersystem.demo.serviceImpl;

import com.ordersystem.demo.model.OrderMaster;
import com.ordersystem.demo.respoistory.OrderMasterRespoistory;
import com.ordersystem.demo.service.OrderMasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderMasterServiceImpl implements OrderMasterService {

    @Autowired
    private OrderMasterRespoistory respoistory;

    @Override
    public List<OrderMaster> findAll() {
        return respoistory.findAll();
    }

    @Override
    public OrderMaster save(OrderMaster orderMaster) {
        return respoistory.save(orderMaster);
    }

    @Override
    public boolean findByOpenId(String openId) {
        boolean retBln;
        if(respoistory.findByBuyerOpenid(openId).size()>0){
            retBln=true;
        }else{
            retBln=false;
        }
        return retBln;
    }
}
